<?php

/**
 * static actions.
 *
 * @package    Your name
 * @subpackage static
 * @author     John Doe <you@example.com>
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class staticActions extends sfActions
{
  public function executeGuessCulture(sfWebRequest $request)
  {
    $this->getUser()->setCulture($request->getPreferredCulture(sfConfig::get('app_available_cultures')));
    
    $this->redirect('localized_homepage');
  }

  public function executeThankYou(sfWebRequest $request)
  {

  }

  public function executeContact(sfWebRequest $request)
  {
    $this->form = new ContactForm();
    
    if ($request->isMethod(sfRequest::POST))
    {
      $this->form->bind($request->getParameter($this->form->getName()));
      
      if ($this->form->isValid())
      {
        $values = $this->form->getValues();
        $this->getMailer()->composeAndSend(
          array($values['email'] => $values['name']),
          sfConfig::get('app_contact_email'),
          '[HugoHamon.com] '. $values['subject'],
          $values['message']
        );
        
        $this->redirect($this->generateUrl('thank_you'));
      }
    }
  }
}
